package media_user_service

import (
	"hytx_media/models"
	"hytx_media/service/setting_service"
)

type MediaUser struct {
	Phone    string
	Password string
	Status   int
}

func (m *MediaUser) Add() error {

	mediaUser := map[string]interface{}{
		"phone":    m.Phone,
		"password": m.Password,
		"status":   1,
	}

	if err := models.MediaUserAdd(mediaUser); err != nil {
		return err
	}

	return nil
}

func GetUserInfo(userId int) *models.Profile {
	data, _ := models.GetUserInfo(userId)
	data.IsExpire = setting_service.UserInfoChangeExpire(userId)
	return data
}

func UserInfo(userId int) (*models.UserI) {
	info, _ := models.UserInfo(userId)
	return info
}
